package com.tengju.support.domain.model.resource;

import lombok.AllArgsConstructor;

@AllArgsConstructor
public enum Position {

    APP_BANNER(1,"APP首页轮播"),
    ;

    private Integer val;
    private String desc;

    public Integer getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    public static Position fromVal(Integer val) {
        for (Position type : values()) {
            if (type.val.equals(val)) {
                return type;
            }
        }
        return null;
    }

    public static Position fromName(String name) {
        for (Position type : values()) {
            if (type.name().equals(name)) {
                return type;
            }
        }
        return null;
    }
}
